using System;

namespace Agron.Services.SessionController
{
    /// <summary>
    /// Provides event data for the <see cref="SessionManager.SessionFinished"/> event.
    /// </summary>
    [Serializable]
    public class SessionFinishedEventArgs : EventArgs
    {
        private readonly bool _errorOccurred;
        private readonly string _errorMessage;

        /// <summary>
        /// Initializes a new instance of the <see cref="SessionFinishedEventArgs"/> class.
        /// </summary>
        public SessionFinishedEventArgs() { }

        /// <summary>
        /// Initializes a new instance of the <see cref="SessionFinishedEventArgs"/> class with an error message.
        /// </summary>
        /// <param name="errorMessage">A <see cref="String"/> that contains the error message.</param>
        public SessionFinishedEventArgs(string errorMessage)
        {
            this._errorOccurred = true;
            this._errorMessage = errorMessage;
        }

        /// <summary>
        /// Gets a value indicating whether [error occurred].
        /// </summary>
        /// <value><c>true</c> if [error occurred]; otherwise, <c>false</c>.</value>
        public bool ErrorOccurred { get { return this._errorOccurred; } }

        /// <summary>
        /// Gets the error message.
        /// </summary>
        /// <value>
        /// A <see cref="SessionFinishedEventArgs"/> that contains the string.
        /// </value>
        public string ErrorMessage { get { return this._errorMessage; } } 
    }
}
